Skip to content

[refactor](fe) Unify audit statistics participant tracking - #70545

Open
Gabriel39 wants to merge 1 commit into
apache:masterfrom
Gabriel39:dev/generic-audit-statistics
Open

Gabriel39 wants to merge 1 commit into
apache:masterfrom
Gabriel39:dev/generic-audit-statistics

Conversation

@Gabriel39

Copy link
Copy Markdown
Contributor

Background

BE runtime statistics arrive asynchronously, so FE audit logging waits for final reports from the backends that received fragment dispatch attempts. The current implementation already supports generic participant tracking but also retains a separate coordinator and executor classification for external writes.

What problem does this PR solve?

Issue Number: None
Related PR: #67053 (introduced external-write-specific audit tracking)
PR Type: Refactor

Problem Summary:

Remove the external-DML-specific audit state, accessors, and executor-type checks. Table inserts use their existing shared execution coordinator, and FILES inserts publish their coordinator through the same statement execution state. Audit participants come from dispatched backend IDs and the existing query-scoped failure snapshot.

Details

  • Moves vs. logic changes: Remove the duplicate external-write coordinator registration and classification helper. Rename the scheduler participant accessor to getDispatchedBackendIds() and update its callers and tests.
  • Behavior change: FILES inserts publish the execution coordinator through StmtExecutor.setCoord(), sharing the existing audit and cancellation handoff. Participant selection, final-report waiting, timeout fallback, and failure snapshots retain their existing rules.
  • Compatibility: No Thrift field IDs, types, or optionality change; the forwarding-field edit only updates its comment. No storage format changes.
  • Performance impact: Remove an extra retained coordinator reference and an extra participant source. No additional threads, locks, queues, or waits.
  • Rollback: Revert this PR; no migration is required.

Testing

  • Locally ran run-fe-ut.sh --run for eight suites: AuditLogHelperBackendSelectionTest, MasterOpExecutorBackendSelectionTest, PipelineExecutionTaskTest, WorkloadRuntimeStatusMgrTest, InsertIntoTableCommandTest, InsertIntoTVFCommandTest, OlapInsertExecutorTest, and StreamingInsertTaskAuditTest: 76 tests passed, with no failures, errors, or skips.
  • The two new FILES command tests failed before the change because the standard coordinator was absent. Both now pass and cover successful execution, partial dispatch failure, retained participants, and coordinator cleanup.
  • FE Checkstyle: zero violations.
  • git diff --check: passed.

Release note

None

Check List (For Author)

  • Behavior changed: Yes (see Details)
  • Does this need documentation: No
  • Pre-submission status: Ready

AI Disclosure

  • Tool: Codex (GPT-6)
  • Generated: Code changes, tests, and this description.
  • Human review: Pending.

### Background

BE runtime statistics arrive asynchronously, so FE audit logging waits for final reports from the backends that received fragment dispatch attempts. The current implementation already supports generic participant tracking but also retains a separate coordinator and executor classification for external writes.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#67053 (introduced external-write-specific audit tracking)
PR Type: Refactor

Problem Summary:

Remove the external-DML-specific audit state, accessors, and executor-type checks. Table inserts use their existing shared execution coordinator, and FILES inserts publish their coordinator through the same statement execution state. Audit participants come from dispatched backend IDs and the existing query-scoped failure snapshot.

### Details

- **Moves vs. logic changes:** Remove the duplicate external-write coordinator registration and classification helper. Rename the scheduler participant accessor to `getDispatchedBackendIds()` and update its callers and tests.
- **Behavior change:** FILES inserts publish the execution coordinator through `StmtExecutor.setCoord()`, sharing the existing audit and cancellation handoff. Participant selection, final-report waiting, timeout fallback, and failure snapshots retain their existing rules.
- **Compatibility:** No Thrift field IDs, types, or optionality change; the forwarding-field edit only updates its comment. No storage format changes.
- **Performance impact:** Remove an extra retained coordinator reference and an extra participant source. No additional threads, locks, queues, or waits.
- **Rollback:** Revert this PR; no migration is required.

### Testing

- Locally ran `run-fe-ut.sh --run` for eight suites: `AuditLogHelperBackendSelectionTest`, `MasterOpExecutorBackendSelectionTest`, `PipelineExecutionTaskTest`, `WorkloadRuntimeStatusMgrTest`, `InsertIntoTableCommandTest`, `InsertIntoTVFCommandTest`, `OlapInsertExecutorTest`, and `StreamingInsertTaskAuditTest`: 76 tests passed, with no failures, errors, or skips.
- The two new FILES command tests failed before the change because the standard coordinator was absent. Both now pass and cover successful execution, partial dispatch failure, retained participants, and coordinator cleanup.
- FE Checkstyle: zero violations.
- `git diff --check`: passed.

### Release note

None

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: No
- Pre-submission status: Ready

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: Code changes, tests, and this description.
- Human review: Pending.
@Gabriel39

Copy link
Copy Markdown
Contributor Author

run buildall

@Gabriel39

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed at the pinned PR head b38bc4b. The change consistently publishes insert coordinators through StmtExecutor.setCoord, preserves dispatched-backend accounting through coordinator close and retry cleanup, and renames the dispatch-ID accessors without changing behavior. I found no verified new P0-P3 issue and no existing blocking inline finding applies. FE-core checkpoints: no metadata-locking or lock-order path changed; no new exception or RPC boundary is introduced; no Nereids rule, stage-order, join, or property-derivation change is present. The FrontendService.thrift edit changes only the comment for existing optional field 12, with its id, type, and optionality unchanged. The changed tests cover successful and partial-dispatch TVF execution and preserve the audit/forwarding assertions. This was a static review under the supplied contract; no build or test execution was performed. There were no user-provided focus points. Convergence was reached in round 1: all three assigned review sections returned NO_NEW_VALUABLE_FINDINGS, required coverage was completed, and the final sweep found no unresolved candidate.

Review converged after 1 round(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant